package com.woniuxy.main.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import com.woniuxy.main.pojo.Vi_user_complain;

public interface Vi_user_complainMapper {
	
	//分页查询所有学员申诉信息，一页显示8个
	@Select("select * from vi_user_complain where userRole='student' and isSuccess=0 order by cpid limit #{page},8")
	public List<Vi_user_complain> showStudentComplain(int page);
	
	//查询未处理学员申诉总数
	@Select("select COUNT(*) from vi_user_complain where userRole='student' and isSuccess=0")
	public int totalStudentComplainPage();
	
	//分页查询所有教练申诉信息，一页显示8个
	@Select("select * from vi_user_complain where userRole='coach' and isSuccess=0 order by cpid limit #{page},8")
	public List<Vi_user_complain> showCoachComplain(int page);
		
	//查询未处理教练申诉总数
	@Select("select COUNT(*) from vi_user_complain where userRole='coach' and isSuccess=0")
	public int totalCoachComplainPage();
	
	//分页查询所有场馆申诉信息，一页显示8个
	@Select("select * from vi_user_complain where userRole='gym' and isSuccess=0 order by cpid limit #{page},8")
	public List<Vi_user_complain> showGymComplain(int page);
		
	//查询未处理场馆申诉总数
	@Select("select COUNT(*) from vi_user_complain where userRole='gym' and isSuccess=0")
	public int totalGymComplainPage();
	
	//判断当前用户是否已经提交过申诉
	@Select("select cpReason from complain where uid=#{uid} and isSuccess=0")
	public String isComplainExist(int uid);
	
	@Insert("insert into complain(uid,cpReason) values(#{uid},#{cpReason})")
	public int addComplain(Map<String,Object> request);

}
